﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="static/eth/css/login1.css" />
<script type="text/javascript" src="lib/jquery/1.7.1/jquery.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui-3.1.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script>
<title>登录</title>
</head>
<body>
<div class="container">
    <form class="form-signin" id="form">
        <h2 class="form-signin-heading">请登陆</h2>
        <label for="userCode" class="sr-only">账户</label>
        <input type="text" id="userCode" class="form-control" placeholder="账户" name="userCode" required>
        <label for="inputPassword" class="sr-only">密码</label>
        <input type="password" id="inputPassword" class="form-control" placeholder="密码" name="password" required>
		<input type="text" id="vali" name="vali" class="form-control" style="width:30%;float:left" placeholder="验证码" /> 
		<img id="img" src="login-getImage"  onclick="changeImg()" style="height:auto;margin-left:30px;"/>
        <button id="submit1" class="btn btn-lg btn-primary btn-block" type="button">登陆</button>
      </form>
</div>
<script>
(function() {
   if (window!=top)
	top.location.href =window.location.href;
  $('#submit1').click(function(){
	  var param = $('#form').serialize();
      jQuery.ajax({  
        type : 'POST',  
        contentType : 'application/json',  
        url : 'login-code?' + param,  
        success : function(data) {
      	  var rsult = jQuery.parseJSON(data);
      	  if (rsult.success) {
      		  window.location.href="index-page";
      	  } else 
      		  alert("登录失败!原因:" + rsult.message);
        },  
        error : function(data) {  
            alert("登录失败！")  
        }  
      });
	});
})();
function changeImg() {
	$('#img').attr('src', 'login-getImage?random=' + Math.random());
}
</script>
</body>
</html>